import React from 'react'
import {withRouter} from 'react-router-dom'
import './home2Alert.less'
class Home2Alert extends React.Component {
    constructor() {
        super();
        this.state = {
            msg: 'Home2Alert'
        }
    }
    render() {
        console.log(this.props)
        return (
            <div className="Home2Alert">
                <div style={{ fontSize: '.42rem', fontWeight: '600', padding: '0' }}>附近地址</div>
                {
                    this.props.parentInfo.state.nearposi===undefined?null:
                    this.props.parentInfo.state.nearposi.map((item,index)=>{
                        return <div key={item.id} 
                        onClick={()=>{this.nearPosi(item,index)}}
                        className="every_nearposi"
                        >
                            <div>{item.name}</div>
                            <div>{item.address}</div>
                        </div>
                    })
                }
            </div>
        )
    }
    nearPosi=(item,i)=>{
        this.props.parentInfo.getNearBy(item)
        this.props.parentInfo.closeHome2Alert(false)
    }
    componentDidMount() {
        
    }
}
export default withRouter(Home2Alert)